#sample not use items
import logging
class Item:
    def __init__(self,ele,wave,value=None,mode=None):
        self.ele=ele
        self.wave=wave
        self.mode=mode
        self.value=value
        pass
class Sample2:
    def __init__(self):
        self.time=None
        self.sampleid=None
        self.mass=None
        self.beizhu=""
        self.num=0
    def __str__(self):
        return str(self.sampleid)
    #     self.items={}
    # def __getattribute__(self, attr): #注意：attr是传入的属性名,不是属性值
    #     ws=attr.split("_")   #"_" is special char can not used in attr
    #     if len(ws)==2:
    #         (ele,wave)=ws
    #         return (self.items[(ele,wave)])
    #     return object.__getattribute__(self, attr) #返回属性名
    # def __setattr__(self, attr,value): #注意：attr是传入的属性名,不是属性值
    #     # logging.info([attr,value])
    #     ws=attr.split("_")   #"_" is special char can not used in attr
    #     if len(ws)==2:
    #         (ele,wave)=ws
    #         self.items[(ele,wave)]=value
    #     return object.__setattr__(self, attr,value)

if __name__=="__main__":
    s=Sample2()
    s.sampleid="001"
    s.items={"a":"a","b":"b"}
    print(s.sampleid,s.a,s.b)
    s.a="a2"
    print(s.sampleid,s.a,s.b)